package com.study.example.gameserver;

import com.sparrow.common.metric.MetricsManager;
import com.sparrow.common.thread.ThreadPool;
import com.sparrow.socket.tcp.session.impl.GameSession;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class GameShutDownHandler extends Thread {
    private static final Logger logger = LoggerFactory.getLogger(GameShutDownHandler.class);
    private final AnnotationConfigApplicationContext context;

    public GameShutDownHandler(AnnotationConfigApplicationContext context) {
        this.context = context;
    }


    @Override
    public void run() {
        context.close();
        ThreadPool.shutdown();
        MetricsManager.shutdown();
        logger.info("游戏服关服成功");
    }

}
